package test.h0815;

import java.util.Scanner;

public class Main4 {
    //40 40 18
    //1484
    static int m;
    static int n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        m = sc.nextInt();
        n = sc.nextInt();
        int k = sc.nextInt(); //k

        System.out.println(getResult(m, n, k));
    }

    static int ans = 0;

    private static int getResult(int m, int n, int k) {
        int[][] graph = new int[m][n];
        boolean[][] visited = new boolean[m][n];
        //DFS
        dfs(0, 0, k, visited);
        return ans;
    }

    private static void dfs(int i, int j, int k, boolean[][] visited) {
        //构造递归条件
        if (i < 0 || i >= m || j < 0 || j >= n || digitSum(i) + digitSum(j) > k||visited[i][j]) {
            return;
        }
        visited[i][j] = true;
        ans++;
        //进行递归
        dfs(i - 1, j, k, visited);
        dfs(i + 1, j, k, visited);
        dfs(i, j - 1, k, visited);
        dfs(i, j + 1, k, visited);
    }

    //求数位和
    private static int digitSum(int num) {
        int sum = 0;
        while (num != 0) {
            sum += num % 10;
            num /= 10;
        }
        return sum;
    }
}
